package woaini.wind.bot.core.adapter;

import lombok.extern.slf4j.Slf4j;
import woaini.wind.bot.core.bot.Bot;
import woaini.wind.bot.core.event.base.Event;

/**
 * http适配器
 *
 * @see woaini.wind.bot.core.adapter.HttpAdapter
 * @author yefeng {@date 2024-12-27 14:59:20}
 */
@Slf4j
public abstract class HttpAdapter extends Adapter {

  public HttpAdapter(Bot bot) {
    super(bot);
  }

  public void httpHook(String message){
    Event decode = decode(message);
    if (decode != null){
      bot.addEvent(bot,decode);
    }
  }

  @Override
  public boolean connect() {
    log.info("http连接成功:{}-{}",bot.getPlatForm(),bot.getSelfId());
    return true;
  }

  @Override
  public boolean reconnect() {
    return true;
  }

  @Override
  public void close() {}
}
